<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>登录页面</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css"/>
    <link rel="shortcut icon" type="image/x-icon" href="/img/favicon.png"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
</head>
<body>
<center>
    <div>
        <div th:if="${param.error}">
            Invalid username and password.
        </div>
        <div th:if="${param.logout}">
            You have been logged out.
        </div>
        <form th:action="@{/login}" method="post">
            <div><label> User Name : <input type="text" name="username"/> </label></div>
            <div><label> Password: <input type="password" name="password"/> </label></div>
            <div>
                <label for="imageCode">图形验证码</label>
                <input type="input" id="imageCode" name="imageCode" required>
<!--                请求后端获取图片-->
                <img src="/code/image"/>
            </div>

<!-- 模拟短信验证登录-->
<!--            <div>-->
<!--                <label for="smsCode">短信验证码</label>-->
<!--                <input type="input" id="smsCode" name="smsCode" >-->
<!--                <button onclick="getSmsCode()">获取验证码</button>-->
<!--            </div>-->

<!--            *增加记住我复选框，注意name必须为"remember-me"*-->
            <input type="checkbox" name="remember-me"/>记住我<br>
            <div><input type="submit" value="Sign In"/></div>
        </form>

<!--        <form id="form" method="post" th:action="@{/login}">-->
<!--            <label>用户名：</label><input type="text" name="name" value=""/>-->
<!--            <label>密码：</label><input type="text" name="pwd" value=""/>-->
<!--            <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />-->
<!--            <br/>-->
<!--            <input type="submit" value="登录"/>-->
<!--        </form>-->
    </div>
</center>
<script >

function getSmsCode() {
    var ajax = new XMLHttpRequest();
    ajax.open('get','/code/sms');
    ajax.send();
}

</script>
</body>
</html>